package com.jwdf.uda.http.action;

import android.content.Context;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;

import retrofit2.Call;

/**
 * Created by Administrator on 2016/5/12.
 */
public class LoginAction extends AHttpService<PbBean.PbResUserLogin> {

    private String userName;
    private String password;


    public static LoginAction newInstance(Context context,String userName,String password) {
        return new LoginAction(context,userName,password);
    }

    private LoginAction(Context context,String userName,String password) {
        super(context);
        this.userName=userName;
        this.password=password;
    }

    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqUserLogin.Builder builder = PbBean.PbReqUserLogin.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setUsername(userName);
        builder.setPassword(password);

        return apiService.login(builder.build());
    }
}
